Repository navigation
fix(user-management): Reject non-user access tokens in session cookies - #1753
Merged
Merged
Conversation
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
Original prompt from madison.packer
|
Contributor
Devin Review🟢 Devin Review found nothing to fix · View findings |
Contributor
[Medium impact] The PR appears safe to merge. SummaryBoth cookie authentication methods now call
|
CookieSession.authenticate and authenticateWithSessionCookie now validate the cookie's access token with verifyAccessToken, so they apply the same access token claim checks (hasRequiredAccessTokenClaims) as direct verification instead of only checking signature, expiry and issuer. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration
Bot
force-pushed
the
fix/cookie-session-user-token-family
branch
from
November 4, 2026 21:30
9b439d9 to
86e3cd1
Compare
imkesin
approved these changes
Nov 4, 2026
imkesin
left a comment
Contributor
There was a problem hiding this comment.
Beautiful reduction in LOC (at least across non-test files)
m0tzy
commented
Nov 4, 2026
…ed payload Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
|
@greptileai review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Session cookie validation now applies the same access-token claim checks as
verifyAccessToken().Previously
CookieSession.authenticate()andauthenticateWithSessionCookie()verified only the JWT signature, expiry and issuer. Both now callverifyAccessToken(), which also runshasRequiredAccessTokenClaims:sidandauth_timemust be present.sub_profilemust be absent oruser.sub_typemust be absent.A cookie whose access token fails those checks returns
invalid_jwt.CookieSessionalso drops its duplicatejwtVerifycall.Other behavior changes in
CookieSession, which now matchverifyAccessToken():invalid_jwtinstead of throwing. The same applies to a missingkidwhile multiple keys are active, and to an unsupportedalg.Must provide clientId to initialize JWKS.New specs cover
CookieSession.authenticate()andauthenticateWithSessionCookie()when the cookie's access token hassub_profile: ai_agentorsub_type: authkit. Existing specs that mockedjwtVerifywith an empty payload now mock it with a user access token payload.Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.
Link to Devin session: https://app.devin.ai/sessions/7e123fc2545a49c282b043a4abd58f70
Open in Devin Desktop: https://app.devin.ai/desktop/session/7e123fc2545a49c282b043a4abd58f70?variant=devin
Requested by: @m0tzy